using System.Web.UI;
using Sedna.Core.Controller;
using Sedna.Core.Controller.Configurations;

namespace Sedna.Core.Controls.Grid
{
    class GridSelectHeaderCheckBox : System.Web.UI.WebControls.CheckBox
    {
        private string dataGridClientVar;

        public string DataGridClientVar
        {
            get { return dataGridClientVar; }
            set { dataGridClientVar = value; }
        }

        public GridSelectHeaderCheckBox(IConfiguration configuration)
        {
            this.dataGridClientVar = ((IGridCheckBoxConfiguration)configuration).DataGridClientVariable;
        }

        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            writer.AddAttribute("onclick", dataGridClientVar+".setMarkAll(0, this.checked);");
            base.AddAttributesToRender(writer);
        }
    }
}
